var g_player;
var timeout, rotate = 0;
function startAnim() {
	g_player.play();
	timeout = setInterval(function () {
		var img = document.getElementById("img");
		var rotateStyle = "rotate(" + rotate + "deg)";
		img.style.transform = rotateStyle;
		img.style["-moz-transform"] = rotateStyle;
		img.style["-webkit-transform"] = rotateStyle;
		img.style["-o-transform"] = rotateStyle;
		img.style["-ms-transform"] = rotateStyle;
 
        rotate += 6;
        if (rotate > 360) {
            rotate = 0;
        }
    }, 30);
    
    
	var slider = mui("#slider");
	slider.slider({ interval: 5000 });
}

function stopAnim() {
    clearInterval(timeout);
    timeout = null;
    g_player.pause();
}
 
window.onload = function() {

    g_player = document.getElementById('player');
    
    //页面加载时播放的第一个文件
    g_player.src = "mp3/yinyue.mp3";
    g_player.addEventListener('ended', myFunction)
    function myFunction() {     
        g_player.play();
    }
    
    startAnim();
    
    searchFun();
}

function searchFun(){
	var btnSearch=document.getElementById("searchId");
	btnSearch.onclick = function() {
		
		$('#nav').find('.mui-tab-item').children().removeClass('mui-active');
		$('#nav').find('.mui-tab-item').removeClass('mui-active');
		
		$('#nav').find('.mui-tab-item').eq(2).addClass('mui-active');

		$('#tabbar-with-contact').siblings().removeClass('mui-active');
		$('#tabbar-with-contact').addClass('mui-active');

	}
}

